import router from "@system.router";
import { getAuthorization } from "./service";

export default {
    onCreate() {
        console.info('timelogger onCreate');
        this.init()
    },
    onDestroy() {
        console.info('timelogger onDestroy');
    },
    async init() {
        try {
            if (!(await getAuthorization())) {
                router.replace({
                    uri: "pages/login/login",
                });
                return;
            }
        } catch (error) {
            console.error('onCreate failed. Cause: ' + error.toString());
        }
    }
};
